Skip to content

perf(lark,native_chat): coalesce listener snapshots and cache recovery event summaries - #9100

Merged
loopx-agent merged 1 commit into
mainfrom
codex/steward-listener-event-cache-20261120
Nov 19, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/steward-listener-event-cache-20261120

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

动机 / Motivation

在 PR #9098 上线并将 ?view=diagnostics 轮询与后台 .events.jsonl 锁风暴显著压低后,对实机 com.loopx.chat 进行 sample + cProfile + ps 实时剖析仍观测到三处剩余放大路径:

  1. 每秒 3 次无意义 lark-cli profile list 子进程与全量 registry 重读:3 条 loopx-lark-stop-<profile> 监控线程每隔 1.0s 各调一次 listener_snapshot()(此前 goal_topic_runtime_service.py 直接透传 snapshot_provider()),导致每分钟约 180 次 lark-cli profile list 子进程冷启(~51ms/次)及每秒 3 次重解析全局 registry(~165 KB,~15.5ms/次)。
  2. _context_recovery_plan(..., discovery_only=True) 击穿 8-Turn 事件缓存,每分钟触发 ~65 次 read_chat_events 锁写入:后台错峰扫描约 70+ 个历史失败 Turn 时调用 _started_native_inputs() 读取 store.events_after(),持续淘汰仅有 TERMINAL_CACHE_MAX_TURNS=8 容量的 ChatEventCache 并反复重写 .events.jsonl.lock。
  3. LarkPrivateConversations.health() 重复 stat 与重读恢复请求:read_backlog_requests() 对约 99 个含 context_recovery / native_result_recovery 的已交付请求返回 project(...) -> None 导致每次轮询全量重解析;同时 read_backlog_requests、QuotaBacklogObservationCache.build_key_prefix 与 source_controls 对相同 ~1,580 个请求文件分别执行 3 次 stat。

改动 / Changes

  1. 单飞合并的 listener_snapshot 短 TTL 缓存(goal_topic_runtime_service.py)
    • 在 LarkGoalTopicRuntimeService 增加 _LISTENER_SNAPSHOT_TTL_SECONDS = 5.0、单飞等待条件锁 _listener_snapshot_cond 与 _read_listener_snapshot() / _invalidate_listener_snapshot() / _seed_listener_snapshot()。
    • 多条监控线程并发请求时仅执行一次 snapshot_provider() 并共享结果;异常绝不缓存;_refresh_profile_workers() 先失效再原子注入最新 snapshot;close() 立即失效。事件分发、消息回复与停止检查仍直接读取实时 snapshot_provider()。
  2. 紧凑 Turn 事件摘要缓存与指纹复用发现器(file_discovery.py)
    • 将 QuotaBacklogObservationCache._interrupt_events 升级为有界 _event_summaries(仅存 (single_anchor, steering_observed, interrupt_observed),不保留完整事件列表),新增 observed_turn_event_summary 并复用 flush_lock -> _event_lock -> _event_pending 空检查及 optional_file_fingerprint 前后校验;保留 observed_turn_interrupt / get_interrupt / put_interrupt / drop_interrupt 兼容接口。
    • 在 build_key_prefix 增加可选 req_fp_override 复用调用方同轮已取得的请求文件指纹(缓存失效提交前仍在 commit() 内新鲜重验)。
    • 在 FileChatDiscovery 增加 rows_with_fingerprints(..., known_fingerprints=None),并由 rows() 复用该实现避免代码重复。
  3. 仅发现路径的事件摘要复用、延迟恢复读取与同轮指纹复用(external_conversations.py、private_conversations.py)
    • _context_recovery_plan() 仅在 discovery_only=True、非 retained_review 且非 manager_authorization_unavailable / image_failure / runtime_failure 时改走 observed_turn_event_summary;完整准入(discovery_only=False)与所有准备失败类型仍走完整新鲜的 store.events_after()。
    • read_backlog_requests(..., defer_recovery=False, observed_fps=None) 缓存所有合法请求的有界元数据与 _has_recovery 标记(绝不缓存恢复正文),并在 LarkPrivateConversations.health() 中开启 defer_recovery=True 与 observed_fps 透传给 quota_backlog_observer(use_cache=True, observed_fps=observed_fps) 及 source_controls(known_fingerprints=known_fingerprints);仅在缓存未命中时由 _quota_pending_inputs() 读取完整请求文件。
    • 保持 private_conversations.py 1,998 行(<=1,999)、external_conversations.py 1,996 行(<2,000)。
  4. 单元测试与失效回归(tests/test_lark_steward_directory_scan_perf.py)
    • test_listener_snapshot_coalesces_concurrent_watchers_and_invalidates_on_refresh
    • test_context_recovery_discovery_caches_turn_event_summary_without_event_lock_churn
    • test_backlog_health_defers_recovery_body_reads_and_reuses_request_fingerprints

本地验证 / Verification

  • ruff check(5 个修改文件):PASS,All checks passed!
  • pytest -v tests/test_lark_steward_directory_scan_perf.py:14 passed in 105.27s
  • 完整相关性回归:758 passed on test_lark_steward_directory_scan_perf.py + test_private_chat_backlog_projection.py + test_chat_file_discovery.py + test_context_recovery_discovery.py + test_lark_realtime_dispatch.py + test_lark_private_compatibility.py + test_lark_private_conversations.py + 100/101 test_lark_goal_topic_runtime.py,以及重跑 test_native_mention_reaches_the_running_topic_before_its_ordinary_reply 全部 15 passed in 100.98s
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main:PASS(ok: true,direct_checks 4/4 + py_compile,catalog_canaries 2/2 含 maintainability ratchet 与 semantic vocabulary drift,risk_profile_smokes 8/8,0 失败)
  • Public/private boundary scan:PASS(无本机路径、用户名或私密标识)
  • 视觉评审(visual_review):not_applicable(零 UI/前端文件改动)

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google (self_reported)

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

  • affected_caller_or_operator: 启用多 Lark 监听线程(LarkGoalTopicRuntimeService)、私聊诊断页(LarkPrivateConversations.health)与后台恢复扫描(ChatExternalConversations.context_recovery_observer)的个人守护进程运行方与面板调用方。
  • before_after_scenario: 修改前:(1)3 条 loopx-lark-stop-<profile> 监控线程每 1.0s 各调一次 snapshot_provider(),持续触发约 3 次/秒 lark-cli profile list 子进程启动(~51ms/次)及全局/Goal registry 全量解析(~165KB/次);(2)_context_recovery_plan(..., discovery_only=True) 在扫描约 70+ 个历史失败 Turn 时调用 _started_native_inputs() -> store.events_after(),击穿 8-Turn 事件缓存造成每分钟 ~65 次 .events.jsonl.lock 锁写入;(3)health() 对约 99 个含恢复字段的已交付请求返回 project -> None 造成每次重读完整 JSON,且对相同请求文件分别在 read_backlog_requests、build_key_prefix 与 source_controls 重复执行 3 次 stat。修改后:(1)LarkGoalTopicRuntimeService._read_listener_snapshot() 采用 5.0s TTL + _listener_snapshot_cond 单飞并发合并、失败不缓存并在 _refresh_profile_workers() / close() 立即失效与注入;事件分发与停止控制仍直读实时 snapshot_provider();(2)file_discovery.py 将 _interrupt_events 推广为紧凑 _event_summaries((single_anchor, steering_observed, interrupt_observed)),_context_recovery_plan() 仅在非准备/运行时/图片失败且 discovery_only=True 且无 retained_review 时走摘要缓存;(3)FileChatDiscovery.rows_with_fingerprints()、read_backlog_requests(..., defer_recovery=True, observed_fps=...) 与 build_key_prefix(..., req_fp_override=...) 实现 health() 对已交付请求单次 stat 与零稳态恢复正文重读。
  • observable_outcome: 并发监控读取 coalesces 为 1 次 snapshot_provider() 并在 refresh() 与 TTL 后立即可见变更;12 个超过 8-Turn 缓存上限的历史失败 Turn 在稳态 context_recovery_observer() 下触发 0 次 events_after()、已落盘或 _event_pending 缓冲事件均即时失效,且非 discovery 准入与 manager_authorization_unavailable 仍读新鲜完整事件;health() 在稳态下对恢复请求 0 次 _read_json() 且每个 external-requests/*.json 仅 1 次 stat(mtime 不变覆盖仍即时失效)。全量回归 758 passed + 15/15 重跑全绿、ruff check 全绿、canary premerge 10/10 ok: true。
  • non_goals: 不改变 snapshot_provider 在事件入队/回复/回调处的实时语义,不改变 quota_backlog_observer(use_cache=False) 或 read_backlog_requests(defer_recovery=False) 的默认实时语义,不缓存完整事件正文或恢复正文,也不修改 TypeScript 判定逻辑。

在 PR #9098 合并上线并验证 health() 基础轮询缓存后,对线上 com.loopx.chat 进行 sample / ps / .events.jsonl.lock 复测时仍发现三处持续背景成本:3 条 loopx-lark-stop-* 线程每秒共执行 3 次 lark-cli profile list 与 165KB registry 重解析、_context_recovery_plan(..., discovery_only=True) 击穿 8-Turn 事件缓存重写 .events.jsonl.lock、以及 health() 对含 context_recovery / native_result_recovery 的请求重复读盘且三倍 stat。本次提交 61849c78945267ef457bf9e5e22a0c9ac0a96788 针对上述三处实证瓶颈作低风险闭环收敛。

改动思路 / Approach

  1. 监听快照单飞合并短缓存(goal_topic_runtime_service.py#L367-L403)
    • _read_listener_snapshot() 利用 threading.Condition 协调多线程并发:首个过期请求穿透调用 snapshot_provider(),其余等待并复用该快照;异常绝不写入缓存;_refresh_profile_workers() 先失效再原子注入;close() 立即失效。事件分发、消息回复与停止轮询处保留直接调用 snapshot_provider()。
  2. 有界 Turn 事件摘要缓存与指纹复用发现(file_discovery.py#L142-L465)
    • 将 _interrupt_events 统一升级为 _event_summaries,仅缓存 (single_anchor, steering_observed, interrupt_observed) 三元组,沿用 flush_lock -> _event_lock -> _event_pending 判空与 optional_file_fingerprint TOCTOU 前后一致性校验。
    • 在 FileChatDiscovery 抽象 rows_with_fingerprints(..., known_fingerprints=None) 并让 rows() 委托调用以消除重复逻辑;在 QuotaBacklogObservationCache.build_key_prefix() 增加可选 req_fp_override 复用调用方已取得的指纹(缓存提交前仍会在 commit() 内重新 stat 验证)。
  3. 非关键发现路径复用、延迟恢复读取与行限坚守(external_conversations.py#L164-L320、private_conversations.py#L191-L245)
    • _context_recovery_plan() 仅在 discovery_only=True、无 retained_review 且非 manager_authorization_unavailable / image_failure / runtime_failure 时改走 observed_turn_event_summary,完整准入及准备失败路径保持新鲜 events_after()。
    • read_backlog_requests(..., defer_recovery=True, observed_fps=...) 在 health() 中推迟恢复正文读取至未命中 _quota_pending_inputs() 时按需触发,并通过 _DeferredBacklogRequest(__slots__ 零额外 JSON 键)透传单次 stat 指纹给 build_key_prefix() 与 source_controls(known_fingerprints=...)。
  4. 单元测试与失效回归(tests/test_lark_steward_directory_scan_perf.py#L800-L1090)
    • 覆盖 3 线程单飞合并/TTL 失效/异常不缓存/refresh() 失效注入、12 个失败 Turn 事件摘要命中/刷盘与 _event_pending 缓冲失效/准入与准备失败绕过,以及 health() 零稳态恢复正文读取、单次 stat 与保留 mtime 覆盖失效。

当前边界(current_pr_boundary):本 PR 聚焦收敛守护进程稳态三处高频放大路径(监听快照高频重算、discovery_only 事件锁风暴、health() 恢复请求重读与三倍 stat);线上真实守护进程升版后的 90s 稳态 lark-cli profile list 频次、.events.jsonl.lock 零抖动及 ?view=diagnostics 延迟实测将在合并激活后立即完成。。
架构保留原因(architecture_assessment.reason):监听并发合并置于生命周期拥有者 goal_topic_runtime_service.py;紧凑事件摘要与 rows_with_fingerprints 集中留在 file_discovery.py;external_conversations.py(1,996 行,<2,000)与 private_conversations.py(1,998 行,<=1,999)保持在可维护性门禁以内。全部改动保持默认隔离,不新增持久化状态或第二裁决权。

具体改动 / Changes

关键代码讲解

  1. LarkGoalTopicRuntimeService._read_listener_snapshot(goal_topic_runtime_service.py#L367-L403)
    通过世代计数(_listener_snapshot_generation)避免 _refresh_profile_workers() 并发期间的旧值回填竞态。
  2. observed_turn_event_summary(file_discovery.py#L265-L310)
    与 observed_turn_interrupt 共享同一 flush_lock -> _event_lock -> _event_pending 无锁争用保护,把 single_anchor 深拷贝边界控制在小型锚点字典而非整条事件流。
  3. _DeferredBacklogRequest & read_backlog_requests(external_conversations.py#L58-L70、external_conversations.py#L1897-L1930)
    仅在显式 defer_recovery=True(由 health() 传入)时返回带 __slots__ 属性的 dict 子类,不向序列化对象添加任何字段,未命中或非 deferred 调用保持原行为。

对主干的风险 / Risks

  • 并发测试偶发时序观测:首次跑 8 个文件回归期间恰与并行 canary premerge(含 TypeScript 编译及多路烟测)抢占 CPU,导致未经本次缓存路径的 test_native_mention_reaches_the_running_topic_before_its_ordinary_reply[True-session_queue-128-False-False-False] 在 last_ordinary_answer.wait(40) 出现一次 40s 超时;独立重跑该 15 组参数化用例全部 15/15 通过(含全部 late-binding-* 用例)。
  • 模块行数控制:private_conversations.py 1,998 行(<=1,999)、external_conversations.py 1,996 行(<2,000)、file_discovery.py 565 行、goal_topic_runtime_service.py 1,009 行,通过 maintainability-ratchet。
  • 视觉与 UI:零 UI 改动,visual_review 为 not_applicable。
  • 本地验证记录(未依赖远端 GitHub CI):
    • ruff check(5 个改动文件):PASS,All checks passed!
    • pytest -v tests/test_lark_steward_directory_scan_perf.py:PASS,14 passed in 105.27s
    • 回归批(test_lark_steward_directory_scan_perf.py 等 8 个文件):758 passed;未通过项 [True-session_queue-128-False-False-False] 独立重跑 test_native_mention_reaches_the_running_topic_before_its_ordinary_reply 15 passed in 100.98s
    • loopx canary premerge --from-git-diff --git-diff-base origin/main:PASS,ok: true,10/10 检查全绿(direct_checks 4/4 + py_compile、catalog_canaries 2/2、risk_profile_smokes 8/8,0 失败)

我的整体评价 / Verdict

改动以小幅度、默认隔离及严格的 TOCTOU/世代校验,精准消除了守护进程稳态三处实证放大点,不引入持久状态也不改变任何裁决归属;本地单测、回归与 canary premerge 全绿,满足合入要求。视觉评审说明:Backend/daemon performance and discovery caching optimization only; verified diff touches zero UI, HTML, CSS, or dashboard files.(unverified_scope: none)。

English Verdict: APPROVE

@loopx-agent
loopx-agent merged commit 8e9a28a into main Nov 19, 2026
28 of 36 checks passed
@loopx-agent
loopx-agent deleted the codex/steward-listener-event-cache-20261120 branch November 19, 2026 22:29
loopx-agent added a commit that referenced this pull request Nov 20, 2026
* refactor(core): defer benchmark implementations during capability discovery

Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults.

Signed-off-by: cicolord <[email protected]>

* Defer Yardstick evaluation until an enabled Explore read

Signed-off-by: cicolord <[email protected]>

* Omit empty Todo summary lanes from ordinary Worker context

Signed-off-by: cicolord <[email protected]>

* fix(update): honor configured archive directories during rollback

Signed-off-by: LoopX Agent <[email protected]>

* fix(lark): replay recall guard on current main

Signed-off-by: huangruiteng <[email protected]>

* docs: record the verified LoopX 2.3.0 release baseline

Signed-off-by: LoopX Agent <[email protected]>

* Preserve quota spend source when prepared work is admitted

Signed-off-by: LoopX Agent <[email protected]>

* test(quota): qualify native saved complete-Turn checkpoints

Signed-off-by: LoopX Agent <[email protected]>

* Retry cleanup of an owned file mutation marker

Signed-off-by: LoopX Agent <[email protected]>

* Keep synthetic Git-path test data outside the public source scan

Signed-off-by: LoopX Agent <[email protected]>

* fix(quota): share native preparation wait with readiness

Signed-off-by: LoopX Agent <[email protected]>

* fix(doctor): bind package update readback to its Python environment

Signed-off-by: LoopX Agent <[email protected]>

* Keep Doctor discovery separate from service activation

Signed-off-by: LoopX Agent <[email protected]>

* Verify the recorded Python launcher before Doctor probes it

Signed-off-by: LoopX Agent <[email protected]>

* fix(desktop): require runtime qualification for macOS preview updates

Signed-off-by: LoopX Agent <[email protected]>

* fix(quota): reuse replan projection owners during recovery

Signed-off-by: LoopX Agent <[email protected]>

* Qualify Codex 0.169 native context replay on main

Signed-off-by: LoopX Agent <[email protected]>

* Stop regenerating retired quota view aliases

Signed-off-by: LoopX Agent <[email protected]>

* fix: pin deferred native context reads to the original capture

Signed-off-by: LoopX Agent <[email protected]>

* Keep native capture navigation within small output budgets

Signed-off-by: LoopX Agent <[email protected]>

* Retire legacy heartbeat work prompt generation

Signed-off-by: LoopX Agent <[email protected]>

* Capture C1 composition failures as receipt diagnostics

Signed-off-by: LoopX Agent <[email protected]>

* Recover interrupted native Todo readiness from the original Turn

Signed-off-by: LoopX Agent <[email protected]>

* Revalidate the original lease before publishing resumed native context

Signed-off-by: LoopX Agent <[email protected]>

* Fence native readiness publication with the canonical lease writer

Signed-off-by: LoopX Agent <[email protected]>

* fix(scheduler): keep Codex fallback on the original C1 runtime

Signed-off-by: LoopX Agent <[email protected]>

* fix(scheduler): pin the originating fallback launchers

Signed-off-by: LoopX Agent <[email protected]>

* Retire the duplicate Codex App scheduler projection

Signed-off-by: LoopX Agent <[email protected]>

* Seed the recorded scheduler profile in the elapsed-backoff fixture

Signed-off-by: LoopX Agent <[email protected]>

* Verify canonical cadence on refused and settled Turns

Signed-off-by: LoopX Agent <[email protected]>

* Pin named Core commands in saved scheduler fallbacks

Signed-off-by: LoopX Agent <[email protected]>

* fix(research): preserve saved case addresses when a version cannot open

Signed-off-by: LoopX Agent <[email protected]>

* Preserve citation focus after a saved study refresh

Signed-off-by: LoopX Agent <[email protected]>

* Capture authenticated LoopX receipts for Research attention (#8790)

* feat(research): capture authenticated LoopX attention receipts

Signed-off-by: lusendong.6789 <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>

* fix(research): tighten attention receipt provenance

Signed-off-by: lusendong.6789 <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>

* fix(research): publish attention captures after source validation

Signed-off-by: huangruiteng <[email protected]>

---------

Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: huangruiteng <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: huangruiteng <[email protected]>

* Recover the original Session and Turn from a confirmed Chat task

Signed-off-by: huangruiteng <[email protected]>

* perf(lark,native_chat): eliminate redundant full-directory JSON reparsing in steward chat loops (#9041)

* perf(lark,native_chat): avoid full directory reparsing in steward chat loops

- Make LarkOwnerAttention._route iterate capture candidates lazily so matching stops at the newest valid p2p capture.
- Reuse FileChatDiscovery in PrivateIngressObserver._records while preserving strict field validation and fail-closed errors.
- Reuse FileChatDiscovery in ChatExternalConversations.pending so unchanged request journals skip redundant JSON reads and stay mutation-isolated.
- Add regression and scan-efficiency tests in tests/test_lark_steward_directory_scan_perf.py.

Signed-off-by: LoopX Agent <[email protected]>

* fix(native-chat): project small recovery metadata fields to stop data_url memory growth

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* Retire transitional smoke checks and duplicate execution (#9073)

Signed-off-by: lusendong.6789 <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>

* feat(steward): support probe-gated generic continuous_monitor todos with handoff and user actions (#9074)

Signed-off-by: LoopX Agent <[email protected]>

* Remove redundant defensive prose from prompts and comments (#9072)

Remove redundant defensive prose while preserving published heartbeat wrappers and externally managed skill readiness.

Validated with 197 related tests, independent historical wrapper migrations and negative cases, installed-skill readback, and current-main quick canary. Existing CI qualification and infrastructure limitations remain recorded in PR #9072.

Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: Lusen Dong <[email protected]>

* Keep original Chat retry errors visible during receipt refresh

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): tolerate report validator python drift and allow cancel of mid-turn failed reports (#9077)

Signed-off-by: LoopX Agent <[email protected]>

* feat(steward): add exact-head PR review signals and protected merge confirmation (#9081)

Signed-off-by: LoopX Agent <[email protected]>

* feat(steward): add isolated OpenViking long-term memory with per-speaker boundaries (#9083)

Signed-off-by: LoopX Agent <[email protected]>

* refactor(content-ops): slim surface module and eliminate Any (#8961)

* refactor(content-ops): slim surface module and eliminate Any

Signed-off-by: LoopX Agent <[email protected]>

* fix(content-ops): reject malformed angle source_item_ids containers

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(collaboration): batch handoff query Goal lifetime guard lock per Goal (#9085)

Signed-off-by: LoopX Agent <[email protected]>

* fix(hosts): raise managed service startup readiness timeout to 45s (#9087)

Signed-off-by: LoopX Agent <[email protected]>

* perf(manager-context): memoize history_inspect lifecycle checks and scope runtime revision in handoffs query (#9088)

Eliminate the remaining O(N) Effect runtime RPCs and uncached runtime fingerprinting inside tracking.query(): enter effect_runtime_request_scope() for the query, memoize pure history_inspect lifecycle decisions across entries sharing identical Goal refs while holding the Goal lifetime guard, lazily discover legacy ingress files only when external audience recovery needs them, and preserve entry scan order across Goal batches.

Signed-off-by: LoopX Agent <[email protected]>

* refactor(lark): slim private_conversations below 2000 lines with net LOC reduction (#8929)

Signed-off-by: LoopX Agent <[email protected]>

* perf(chat,hosts): skip frontend source re-hashing on immutable installed releases and extend readiness timeout to 90s (#9089)

Signed-off-by: LoopX Agent <[email protected]>

* refactor(control-plane): split and slim quota monitor_poll_commit (#8885)

* refactor(control-plane): split and slim quota monitor_poll_commit

Signed-off-by: LoopX Agent <[email protected]>

* fix(control-plane): preserve legacy lane budget and observation diagnostic order

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* refactor(quota): slim loopx/quota.py and tighten Any count to zero (#8939)

Signed-off-by: LoopX Agent <[email protected]>

* refactor(native-chat): slim external_conversations below 2k lines and retire ceiling (#8911)

* refactor(native-chat): move steward commission mixin to steward_commands and retire external_conversations ceiling

Signed-off-by: LoopX Agent <[email protected]>

* fix(native-chat): respect include_raw_response in retained result recovery

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* refactor(chat): slim chat_runtime below 1,500 lines, fix entry-point project_contexts guard, and retire ceiling (#8920)

* refactor(chat): move session lifecycle mixin to session_open, deduplicate runtime helpers, and retire ceiling

Signed-off-by: LoopX Agent <[email protected]>

* fix(chat): drop turn_done_events slot before waking waiters on Thread.start failure

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): paginate open PR signal GraphQL, allow signal-unavailable monitor recovery, and cache private delivery scans (#9093)

Signed-off-by: LoopX Agent <[email protected]>

* perf(lark,native_chat): back off noop recovery retries and cache recovery lookups (#9096)

Signed-off-by: LoopX Agent <[email protected]>

* perf(native_chat,lark): cache unchanged quota backlog health and interrupt observations (#9098)

Signed-off-by: LoopX Agent <[email protected]>

* perf(lark,native_chat): coalesce listener snapshots and cache recovery event summaries (#9100)

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: cicolord <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: huangruiteng <[email protected]>
Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: Lusen Dong <[email protected]>
Co-authored-by: cicolord <[email protected]>
Co-authored-by: huangruiteng <[email protected]>
Co-authored-by: Lusen Dong <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
loopx-agent added a commit that referenced this pull request Nov 21, 2026
* fix(cli): preserve typed runtime diagnostics in Turn failures

Signed-off-by: LoopX Agent <[email protected]>

* feat(steward): support per-endpoint model preferences and Codex-to-Antigravity failover (#9141)

Signed-off-by: LoopX Agent <[email protected]>

* Keep the prepared Chat adapter available to a retry (#9134)

A failed worker start can finish cleanup after a same-turn retry has
selected the adapter. Keep its lifetime tied to the Session and let
failed dispatch release its own worker registration. The regression
asserts one upstream turn and explicit adapter closure with the Session.

Port the fix from 4453e4bdd77486ec14b952f88ca893310b32e26c.

(cherry picked from commit 173e42b4f051b885c3a3389e1cad9c5722f7b7dd)

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): recover zero-effect monitors and cleared-replan reports (#9143)

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): admit flexible_primary_available executor transitions in conversation_scope (#9145)

Signed-off-by: LoopX Agent <[email protected]>

* Verify quota gate scope through signed lane references (#9101)

* test(quota): verify scoped gates through complete lane references

Signed-off-by: LoopX Agent <[email protected]>

* Test canonical quota gates in both public response modes

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* Test C1 planning and Host input from the original quota capture (#9102)

* Use recorded quota decisions in the no-Todo settlement regression

Signed-off-by: LoopX Agent <[email protected]>

* Exercise the complete Host prompt from the captured quota source

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* Prepare the CLI budget baseline with a private Git index (#9103)

Signed-off-by: LoopX Agent <[email protected]>

* Exercise C1 Goal delivery and bound replan from the saved source (#9104)

Signed-off-by: LoopX Agent <[email protected]>

* Keep long claim overlap scopes on demand (#9086)

* Link long thin-claim overlap lists to their receipts

Signed-off-by: LoopX Agent <[email protected]>

* Read claim overlap details without copying the lease

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(quota): preserve explicit Monitor Todo selection (#9099)

Carry Todo selection provenance into quota admission. Preserve explicit secondary Monitor polling and recovery from previously admitted receipts.

Signed-off-by: LoopX Agent <[email protected]>

* Keep ready Todo scope details on the required context read (#9106)

Signed-off-by: LoopX Agent <[email protected]>

* Fix archive rollback with custom install directories (#9066)

* refactor(core): defer benchmark implementations during capability discovery

Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults.

Signed-off-by: cicolord <[email protected]>

* Defer Yardstick evaluation until an enabled Explore read

Signed-off-by: cicolord <[email protected]>

* Omit empty Todo summary lanes from ordinary Worker context

Signed-off-by: cicolord <[email protected]>

* fix(update): honor configured archive directories during rollback

Signed-off-by: LoopX Agent <[email protected]>

* fix(lark): replay recall guard on current main

Signed-off-by: huangruiteng <[email protected]>

* docs: record the verified LoopX 2.3.0 release baseline

Signed-off-by: LoopX Agent <[email protected]>

* Preserve quota spend source when prepared work is admitted

Signed-off-by: LoopX Agent <[email protected]>

* test(quota): qualify native saved complete-Turn checkpoints

Signed-off-by: LoopX Agent <[email protected]>

* Retry cleanup of an owned file mutation marker

Signed-off-by: LoopX Agent <[email protected]>

* Keep synthetic Git-path test data outside the public source scan

Signed-off-by: LoopX Agent <[email protected]>

* fix(quota): share native preparation wait with readiness

Signed-off-by: LoopX Agent <[email protected]>

* fix(doctor): bind package update readback to its Python environment

Signed-off-by: LoopX Agent <[email protected]>

* Keep Doctor discovery separate from service activation

Signed-off-by: LoopX Agent <[email protected]>

* Verify the recorded Python launcher before Doctor probes it

Signed-off-by: LoopX Agent <[email protected]>

* fix(desktop): require runtime qualification for macOS preview updates

Signed-off-by: LoopX Agent <[email protected]>

* fix(quota): reuse replan projection owners during recovery

Signed-off-by: LoopX Agent <[email protected]>

* Qualify Codex 0.169 native context replay on main

Signed-off-by: LoopX Agent <[email protected]>

* Stop regenerating retired quota view aliases

Signed-off-by: LoopX Agent <[email protected]>

* fix: pin deferred native context reads to the original capture

Signed-off-by: LoopX Agent <[email protected]>

* Keep native capture navigation within small output budgets

Signed-off-by: LoopX Agent <[email protected]>

* Retire legacy heartbeat work prompt generation

Signed-off-by: LoopX Agent <[email protected]>

* Capture C1 composition failures as receipt diagnostics

Signed-off-by: LoopX Agent <[email protected]>

* Recover interrupted native Todo readiness from the original Turn

Signed-off-by: LoopX Agent <[email protected]>

* Revalidate the original lease before publishing resumed native context

Signed-off-by: LoopX Agent <[email protected]>

* Fence native readiness publication with the canonical lease writer

Signed-off-by: LoopX Agent <[email protected]>

* fix(scheduler): keep Codex fallback on the original C1 runtime

Signed-off-by: LoopX Agent <[email protected]>

* fix(scheduler): pin the originating fallback launchers

Signed-off-by: LoopX Agent <[email protected]>

* Retire the duplicate Codex App scheduler projection

Signed-off-by: LoopX Agent <[email protected]>

* Seed the recorded scheduler profile in the elapsed-backoff fixture

Signed-off-by: LoopX Agent <[email protected]>

* Verify canonical cadence on refused and settled Turns

Signed-off-by: LoopX Agent <[email protected]>

* Pin named Core commands in saved scheduler fallbacks

Signed-off-by: LoopX Agent <[email protected]>

* fix(research): preserve saved case addresses when a version cannot open

Signed-off-by: LoopX Agent <[email protected]>

* Preserve citation focus after a saved study refresh

Signed-off-by: LoopX Agent <[email protected]>

* Capture authenticated LoopX receipts for Research attention (#8790)

* feat(research): capture authenticated LoopX attention receipts

Signed-off-by: lusendong.6789 <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>

* fix(research): tighten attention receipt provenance

Signed-off-by: lusendong.6789 <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>

* fix(research): publish attention captures after source validation

Signed-off-by: huangruiteng <[email protected]>

---------

Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: huangruiteng <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: huangruiteng <[email protected]>

* Recover the original Session and Turn from a confirmed Chat task

Signed-off-by: huangruiteng <[email protected]>

* perf(lark,native_chat): eliminate redundant full-directory JSON reparsing in steward chat loops (#9041)

* perf(lark,native_chat): avoid full directory reparsing in steward chat loops

- Make LarkOwnerAttention._route iterate capture candidates lazily so matching stops at the newest valid p2p capture.
- Reuse FileChatDiscovery in PrivateIngressObserver._records while preserving strict field validation and fail-closed errors.
- Reuse FileChatDiscovery in ChatExternalConversations.pending so unchanged request journals skip redundant JSON reads and stay mutation-isolated.
- Add regression and scan-efficiency tests in tests/test_lark_steward_directory_scan_perf.py.

Signed-off-by: LoopX Agent <[email protected]>

* fix(native-chat): project small recovery metadata fields to stop data_url memory growth

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* Retire transitional smoke checks and duplicate execution (#9073)

Signed-off-by: lusendong.6789 <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>

* feat(steward): support probe-gated generic continuous_monitor todos with handoff and user actions (#9074)

Signed-off-by: LoopX Agent <[email protected]>

* Remove redundant defensive prose from prompts and comments (#9072)

Remove redundant defensive prose while preserving published heartbeat wrappers and externally managed skill readiness.

Validated with 197 related tests, independent historical wrapper migrations and negative cases, installed-skill readback, and current-main quick canary. Existing CI qualification and infrastructure limitations remain recorded in PR #9072.

Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: Lusen Dong <[email protected]>

* Keep original Chat retry errors visible during receipt refresh

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): tolerate report validator python drift and allow cancel of mid-turn failed reports (#9077)

Signed-off-by: LoopX Agent <[email protected]>

* feat(steward): add exact-head PR review signals and protected merge confirmation (#9081)

Signed-off-by: LoopX Agent <[email protected]>

* feat(steward): add isolated OpenViking long-term memory with per-speaker boundaries (#9083)

Signed-off-by: LoopX Agent <[email protected]>

* refactor(content-ops): slim surface module and eliminate Any (#8961)

* refactor(content-ops): slim surface module and eliminate Any

Signed-off-by: LoopX Agent <[email protected]>

* fix(content-ops): reject malformed angle source_item_ids containers

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(collaboration): batch handoff query Goal lifetime guard lock per Goal (#9085)

Signed-off-by: LoopX Agent <[email protected]>

* fix(hosts): raise managed service startup readiness timeout to 45s (#9087)

Signed-off-by: LoopX Agent <[email protected]>

* perf(manager-context): memoize history_inspect lifecycle checks and scope runtime revision in handoffs query (#9088)

Eliminate the remaining O(N) Effect runtime RPCs and uncached runtime fingerprinting inside tracking.query(): enter effect_runtime_request_scope() for the query, memoize pure history_inspect lifecycle decisions across entries sharing identical Goal refs while holding the Goal lifetime guard, lazily discover legacy ingress files only when external audience recovery needs them, and preserve entry scan order across Goal batches.

Signed-off-by: LoopX Agent <[email protected]>

* refactor(lark): slim private_conversations below 2000 lines with net LOC reduction (#8929)

Signed-off-by: LoopX Agent <[email protected]>

* perf(chat,hosts): skip frontend source re-hashing on immutable installed releases and extend readiness timeout to 90s (#9089)

Signed-off-by: LoopX Agent <[email protected]>

* refactor(control-plane): split and slim quota monitor_poll_commit (#8885)

* refactor(control-plane): split and slim quota monitor_poll_commit

Signed-off-by: LoopX Agent <[email protected]>

* fix(control-plane): preserve legacy lane budget and observation diagnostic order

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* refactor(quota): slim loopx/quota.py and tighten Any count to zero (#8939)

Signed-off-by: LoopX Agent <[email protected]>

* refactor(native-chat): slim external_conversations below 2k lines and retire ceiling (#8911)

* refactor(native-chat): move steward commission mixin to steward_commands and retire external_conversations ceiling

Signed-off-by: LoopX Agent <[email protected]>

* fix(native-chat): respect include_raw_response in retained result recovery

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* refactor(chat): slim chat_runtime below 1,500 lines, fix entry-point project_contexts guard, and retire ceiling (#8920)

* refactor(chat): move session lifecycle mixin to session_open, deduplicate runtime helpers, and retire ceiling

Signed-off-by: LoopX Agent <[email protected]>

* fix(chat): drop turn_done_events slot before waking waiters on Thread.start failure

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): paginate open PR signal GraphQL, allow signal-unavailable monitor recovery, and cache private delivery scans (#9093)

Signed-off-by: LoopX Agent <[email protected]>

* perf(lark,native_chat): back off noop recovery retries and cache recovery lookups (#9096)

Signed-off-by: LoopX Agent <[email protected]>

* perf(native_chat,lark): cache unchanged quota backlog health and interrupt observations (#9098)

Signed-off-by: LoopX Agent <[email protected]>

* perf(lark,native_chat): coalesce listener snapshots and cache recovery event summaries (#9100)

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: cicolord <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: huangruiteng <[email protected]>
Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: Lusen Dong <[email protected]>
Co-authored-by: cicolord <[email protected]>
Co-authored-by: huangruiteng <[email protected]>
Co-authored-by: Lusen Dong <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>

* refactor(issue-fix): consolidate maintainer-correction admission and slim pr_lifecycle (#8897)

Signed-off-by: LoopX Agent <[email protected]>

* Fix truncated requests and responses in the Codex API relay (#8713)

* fix(codex relay): fence incomplete model requests before drain

Signed-off-by: LoopX Agent <[email protected]>

* fix(codex relay): surface incomplete upstream responses

Port the verified response framing fix to the request-admission branch. Original candidate 27bc3aee311cdfc6a00466ff9d3b58c7db36e01b.

Signed-off-by: LoopX Agent <[email protected]>

* Bound Codex relay writes to clients that stop reading

Signed-off-by: LoopX Agent <[email protected]>

* Reject upstream chunked responses missing the trailer terminator

Signed-off-by: LoopX Agent <[email protected]>

* Validate upstream chunk data delimiters before relay completion

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(release): repair dsh closeout test, antigravity failover alias, and release download retry (#9147)

Signed-off-by: LoopX Agent <[email protected]>

* docs(release): update v2.4.0 release notes and dsh-loopx-plugin 0.1.1-beta.7 README (#9149)

Signed-off-by: LoopX Agent <[email protected]>

* fix(chat): recover saved answers and diagnose lost workers (#9120)

* fix(chat): recover saved answers and diagnose lost workers

Signed-off-by: LoopX Agent <[email protected]>

* style(lark): keep private_conversations within module line budget

Signed-off-by: LoopX Agent <[email protected]>

* fix(chat): retain execution_worker_exited in pending backlog count

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(chat): resume steward requests lost before dispatch (#9125)

Signed-off-by: LoopX Agent <[email protected]>

* fix(benchmark): restore frozen v1 archives and align checkpoint/runtime tests with C1 defaults (#9151)

Signed-off-by: LoopX Agent <[email protected]>

* fix(release): stabilize CLI help, architecture guards, onboarding gate, and public smokes (#9152)

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): recover report selection across python upgrades and prevent queue kill on observation monitors (#9155)

Signed-off-by: LoopX Agent <[email protected]>

* fix(release): align extensions, chat, presentation, and transport tests for v2.4.0 (#9156)

Signed-off-by: LoopX Agent <[email protected]>

* fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice (Slice B1) (#9154)

* fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice

Signed-off-by: LoopX Agent <[email protected]>

* fix(quota): preserve tokenless identity and exact numeric types in attach_complete_turn_context

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): recover frozen report contract failures and rebind resumed task leases (#9157)

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): recover pre-dispatch runtime failures across endpoints and stop receipt-unknown disk churn (#9159)

Signed-off-by: LoopX Agent <[email protected]>

* fix(control_plane): align lease recovery, settlement readback, and runtime fixtures (#9158)

* fix(control_plane): align lease recovery, settlement readback, and runtime fixtures

Signed-off-by: LoopX Agent <[email protected]>

* fix(control_plane): forward record_capture in worker outage test and harden version type guard

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(control-plane): stabilize v2.4.0 explore, context, and checkpoint tail slice (Slice B4) (#9161)

Signed-off-by: LoopX Agent <[email protected]>

* fix(control-plane): stabilize v2.4.0 replan, monitor recovery, and staged-read slice (Slice B5) (#9160)

Signed-off-by: LoopX Agent <[email protected]>

* docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording (#9162)

* docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording

Signed-off-by: LoopX Agent <[email protected]>

* docs(release): align #9158 and #9161 descriptions with verified commits

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

* fix(steward): tolerate minor JSON delimiter glitches and recover saved report candidates (#9164)

Signed-off-by: LoopX Agent <[email protected]>

* fix(control-plane): preserve bound yardstick reversals in native replan openings (#9165)

Signed-off-by: LoopX Agent <[email protected]>

* fix(native-chat): recover loopback relay 401 failures and isolate test auth (#9167)

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: cicolord <[email protected]>
Signed-off-by: huangruiteng <[email protected]>
Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: Lusen Dong <[email protected]>
Co-authored-by: cicolord <[email protected]>
Co-authored-by: huangruiteng <[email protected]>
Co-authored-by: Lusen Dong <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant